package com.fesine.ch02.synBlockString2;

/**
 * @description: 类描述
 * @author: Fesine
 * @createTime:2016/7/5 8:54
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/7/5 8:54
 */
public class Service {
    private String anyString = new String();
    public void a() {
        try {
            synchronized (anyString) {
                System.out.println("a begin");
                Thread.sleep(3000);
                System.out.println("a end");
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    synchronized public void b() {
        System.out.println("b begin");
        System.out.println("b end");
    }
}
